#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2019 crane <crane@gosun>
#
# Distributed under terms of the MIT license.

"""

"""

# import sys

# sys.stdin = open("./a.txt", "r")

def one_case():
    try :
        row1 = list(map(int, input().strip().split()))
    except Exception as e:
        return False

    n, m = row1[0], row1[1]

    # print(n, m)

    # 销量列表
    qua_lst = list(map(int, input().strip().split()))

    for i in range(m):
        op_lst = input().strip().split()
        op1 = int(op_lst[1])
        op2 = int(op_lst[2])
        print('op_lst ', op_lst )

        # print(op_lst)
        if op_lst[0] == 'Q':

            b, e = op1 - 1, op2 - 1
            if b > e:
                b, e = e, b
            # max_val = max(qua_lst[b: e+1])
            mean_val = int(sum(qua_lst[b: e+1]) / (e-b+1))
            print(mean_val)
        if op_lst[0] == 'U':
            idxA = op1 - 1
            assert idxA < n
            qua_lst[idxA] += op2

    return True

while one_case(): pass
